from PySide2 import QtCore
from PySide2.QtWidgets import QApplication, QMainWindow, QDockWidget, QTextEdit, QWidget, QHBoxLayout, QLabel, \
    QVBoxLayout
from dayu_widgets import MToolButton, MItemViewSet, MLineEdit


class TitleToolBar(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)

        search_line = MLineEdit().search().small()
        search_line.textChanged.connect(self.run)

        add_btn = MToolButton().svg("add_line.svg").icon_only().small()
        expend_btn = MToolButton().svg("tree_view.svg").icon_only().small()
        unexpand_btn = MToolButton().svg("tree_view.svg").icon_only().small()

        # 创建一个水平布局，将标签添加到其中
        layout = QHBoxLayout(self)
        layout.addWidget(search_line)
        layout.addWidget(add_btn)
        layout.addWidget(expend_btn)
        layout.addWidget(unexpand_btn)
        self.setLayout(layout)

    def run(self):
        pass